#!/bin/bash
cd ~/projects/upzl

echo "Pull code ..."
git pull

echo "Package service ..."
./gradlew $1:build -x test

echo "Replace the old package ..."
cp $1/build/libs/$1-0.0.1-SNAPSHOT.jar /var/upzl/$1-$2-test.jar

echo "Restart service ..."
/etc/init.d/upzl-$1-$2-test restart --spring.profiles.active=test-$2 --server.port=$3